<?
include("inc_security.php");

$gs_title	= $module_name . " | Chi tiết";

$record_id	= getValue("record_id");
$db_detail	= new db_query("SELECT * FROM " . $gs_table . " WHERE " . $id_field . " = " . $record_id . " AND lang_id = " . $lang_id);
if(mysql_num_rows($db_detail->result) == 0){
	//Redirect if can not find data
	redirect($gs_error);
}
$detail	= mysql_fetch_array($db_detail->result);
unset($db_detail);

// Update ct_status
if($detail["ct_status"] == 0){
	$db_update	= new db_execute("UPDATE " . $gs_table . " SET ct_status = 1 WHERE " . $id_field . " = " . $record_id);
	unset($db_update);
}
?>
<html>
<head>
<title><?=$gs_title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" media="all">@import "../css/GSportal.css";</style>
<script language="javascript" src="../js/library.js"></script>
</head>
<body>
<div class="bg_title_content">
<div class="content_title" style="float:left"><?=$gs_title?></div>
<div class="content_title" style="float:right"><a title="Đóng cửa sổ" href="javascript:window.close()"><img align="absmiddle" border="0" hspace="5" src="<?=$gs_imagepath?>close.gif" />Đóng</a></div>
</div>
<div align="center" class="content">
<?
$form = new form();
$form->class_form_name	= "form_name_3";
$form->create_table(3, 3, 'width="470"');
?>
<?=$form->create_control("Họ và tên", $arrTitle[$detail["ct_title"]] . ". " . $detail["ct_name"])?>
<?=$form->create_control("Địa chỉ", $detail["ct_address"])?>
<?
$db_city = new db_query("SELECT nat_name FROM nationalize WHERE nat_id = " . $detail["ct_city_id"]);
if($city = mysql_fetch_array($db_city->result)){
	echo $form->create_control("Quốc tịch", $city["nat_name"]);
}
unset($db_city);
?>
<?=$form->create_control("Điện thoại", $detail["ct_phone"])?>
<?=$form->create_control("Di động", $detail["ct_mobile"])?>
<?=$form->create_control("Email", $detail["ct_email"])?>
<?=$form->create_control("Thời gian gửi", date("d/m/Y - H:i A", $detail["ct_date"]))?>
<tr>
	<td class="form_name_3" colspan="2" style="text-align:left">Nội dung :</td>
</tr>
<tr>
	<? $bbcode = new bbcode();?>
	<td class="form_text" colspan="2" style="line-height:16px"><?=$bbcode->show(str_replace("\n", "<br />", $detail["ct_content"]))?></td>
    <? unset($bbcode);?>
</tr>
<?
$form->close_table();
unset($form);
?>
</div>
</body>
</html>
<script language="javascript">self.moveTo((screen.width-document.body.clientWidth)/2, (screen.height-document.body.clientHeight)/2);</script>